

#ifndef UI_H_
#define UI_H_

#include <string>

class UI{

	/*All commands should return the output specified in the command if successful or a specification of the error.
	If no output is specified, return the output 0 when the command succeeded, or _1 if failed. Error
	description should be output to stderr. Support the following commands:*/
	void mkdir <dir_name>; //  _ makes a directory with the given name.
	<fd> create <file_name><flags> ; //_ creates an empty file. Returns a file descriptor <fd>.
	void hdlink<file_to_link_to><new_file_name>; // _ creates a hard link to file_to_link_to. Making a hard link
											//	to directories is not allowed.
	void sflink<dest_to_link_to><new_file_name>; // _creates a soft link to dest_to_link_to. dest can be either
											//	a directory or a file.
	<fd> open <file_name><flags>; // _ opens an existing file returning a file descriptor <fd>. The fd returned
					//should always be the lowest one still free. Flag can be set to "read_only" or "read_and_write".
				//Always remember to check when reading or writing that the file was actually opened for that purpose,
				//otherwise return an error. Your flags should be in the exact syntax specified.
	void close <fd>; // _ close the file associated with the given file descriptor. Release locks on this file
				//held by this process.
	string read <fd> <num_bytes>; // _ Read num_bytes from the file that is identified by fd. Returns the string
				/*read, followed by a newline and then the number of bytes that were actually read. Remember read uses
				the current file pointer to know where to start reading from, and the operation advances the file pointer.
				The output should be shown on stdout.*/
	int write <fd> <string> ; //_ writes the string to the file. Returns the number of bytes actually written.
				/*Remember write uses the current file pointer to know where to start writing from, and the operation
				advances the file pointer.*/
	void writeFile <fd><fileName>; // _imports a real file from linux's file system from the given address into the
				//file fd. In this way files can be imported into the system.
	void lck_rd <fd> ; //_ locks file, so that only read operations are allowed. There is no limit on the number
				/*of processes permitted to read the file. No processes are allowed to write to the file while a process
				holds a read lock to the file. It is not obligatory to lock the file to read it. You should not block
				if it is locked, rather return an error.*/
	void lck_wr<fd> ; /*//_locks file, so that only one process may hold the lock. This process may write to the
			file, and no other processes may write to it or read from it. A child does not inherit this lock.
			It is not obligatory to lock the file to write to it. You should not block if it is locked, rather return an error.*/
	void rlslck_rd<fd> ; //_releases the reading lock held by this process. No other process may release this lock.
	void rlslck_wr<fd> ; //_releases the writing lock held by this process. Only the process which locked the
					//file may release the lock.
	void lseek <fd> <offset> ; /*//_ moves the file pointer to the given offset from start of file. If the
				pointer is set to an offset after the end of the file, this is o.k. If data is later written at
	this point, subsequent reads of the data in the gap return bytes of zeros (until data is actually
			written into the gap). The size of the file should not be updated until data is written to that point.*/

	void rm <file_name>; // _ deletes the file.
	void rmdir <dir_name> ; //_ deletes the directory. A directory can only be deleted if it is empty.
	void rmdir_r<dir_name>; /*// _ recursively deletes directory, all sub_directories and all files.
			If one of the files is open, terminate and return error. It is o.k. if the system starts deleting
			files and then finds one open, to then return an error. This means that the command may be executed partially.*/
	void ls <dir_name> ; /*_ returns a list of the files in the given directory, each file in a different
				line and including the file_name and its size (in bytes). If ls is given without an argument,
				the ls of the current directory should be returned. Output should be as follows: each file/dir in
				the given directory in a separate line, directories have the "/" char appended to the end of their name.*/
	void mv<old_file_name>< new_file_name> ; /*//_ changes the old_file_name to new file name.
			This can be just changing its name in the same directory, or even moving the file to a different directory.*/
	void cd<new_directory >; // _ changes current working directory of the current process to new_directory.
	void swprc<int new_process_num> ; //_ Switches to the context of a different process.
				//Make sure to also switch to the new process' fd table and working directory.
	void crprc<int id>< int parent>; // _Creates a process with the given id. If a process with this id
				/*already exists, return an error. If parent == _1, this process is created with no open files.
				If parent > _1, this process is defined as the child of the process with id parent. This means
				that it is created with an exact copy of the fd table of the parent. If process with id parent
				doesn’t exist return an error. This function doesn’t switch to the context of the newly created
				process, rather it stays in the context of the current process.*/
	void batch<file_name> ; //_ This function is needed to test the file system intensively. It allows executing many commands quickly from a file given as input. Do not wait for a command to return before dispatching the next command. For example, if requested to read a large amount of data, the shell should be able to receive another command even though the read command hasn't finished yet. Each command has the following syntax: [commandName][space][first arg][space][second arg] etc. Each space will be exactly one space. Each command is terminated by a '\n'.

	/*Note – Your shell should support relative paths (e.g.  ../../Mydir/a.out) and absolute paths
	 *  ( e.g. /users/studs/bcs/2009/josh/a.out), for all commands requiring a file_name/dir_name
	 *  as argument. Whenever a file_name or dir_name parameter is supplied, it is assumed to include
	 *   the path (either relative or absolute).

*/


	/*File systems are non_volatile, available even after turning the computer off. Our file system
	 * will also behave this way. When executing the simulator, it will first try and reload file
	 *  FILE_SYS and use the existing file system. If it doesn't exist, start a new file system
	 *   using the parameters defined in the configuration file.
*/
};

#endif /* UI_H_ */
